﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data;
using System.Data.SqlClient;
using System.Text;

namespace DONGTAIWANGYE
{
    public partial class WebForm1 : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {

        }

        protected void Button1_Click(object sender, EventArgs e)
        {
            string strCn = "server=pc.hstc.cn;database=dhd2014112117;uid=2014112117;pwd=19960218";
            SqlConnection cn = new SqlConnection(strCn);
            StringBuilder sb = new StringBuilder(1024);
            sb.Append("UPDATE   Student ");
            sb.Append("SET              No =@No, Name = @Name, Gender = @Gender, College = @College, Age = @Age,Memo = @Memo ");
            sb.Append("WHERE     (No = @No) ");
            SqlParameter[] pms = new SqlParameter[6];
            pms[0] = new SqlParameter("@No", this.txtNo.Text);
            pms[1] = new SqlParameter("@Name", this.txtName.Text);
            pms[2] = new SqlParameter("@Gender", this.txtGender.Text);
            pms[3] = new SqlParameter("@Age", this.txtAge.Text);
            pms[4] = new SqlParameter("@College", this.txtCollege.Text);
            pms[5] = new SqlParameter("@Memo", this.txtMemo.Text);
            int intResult = SqlHelper.ExecuteNonQuery(sb.ToString(), pms);
            this.lblInfo.Text = (intResult < 1) ? "更新失败！" : "更新成功！";
        }

        protected void txtName_TextChanged(object sender, EventArgs e)
        {

        }

        protected void txtNo_TextChanged(object sender, EventArgs e)
        {

        }

        protected void txtGender_TextChanged(object sender, EventArgs e)
        {

        }

        protected void txtAge_TextChanged(object sender, EventArgs e)
        {

        }

        protected void txtCollege_TextChanged(object sender, EventArgs e)
        {

        }

        protected void txtMemo_TextChanged(object sender, EventArgs e)
        {

        }

        protected void SelectNo_Click(object sender, EventArgs e)
        {

        }
    }
}